
//背景色
function hover(data) {
    data.style.background = '#F3F8FB';
}
function out(data) {
    data.style.background = '';
}

//展开关闭
function cat_toggle(img, data) {
    var cat_show = document.getElementById(data).style.display;
    if(cat_show == '' || cat_show == 'block'){
        document.getElementById(data).style.display='none';
        if(img.src) img.src='http://img.sys.aiju.com/bbs/cate_open.gif';
    }else{
        document.getElementById(data).style.display='block';
        if(img.src) img.src='http://img.sys.aiju.com/bbs/cate_fold.gif';
    }
}

//边框色
function fcolor(obj){
    obj.style.border='1px solid #4EA0D1';
    obj.style.background='#F6F9FE';
}
function bcolor(obj){
    obj.style.border='1px solid #BEBEBE';
    obj.style.background='#F4F4F4';
}

//弹出窗口
function openSmall(value) {
	window.open (value, "newwindow", "height=400, width=420, top=150px, left=250px, toolbar=no, menubar=no, resizable=no,location=no, status=no,scrollbars=yes");
	//写成一行
}

//确定选择
function doActions(formId,url,info,checkdo)
{
	var cks = document.getElementsByName("checkId[]");

	//检查是否有选项
	var flag = false;
	for(var i=0;i<cks.length;i++)
		if(cks[i].checked) flag = true;
	if(!flag) {
		window.alert("请至少选择一个记录");
		return;
	}
	if(typeof info != 'undefined' && info=="1")
	{
		if(document.forms[formId].info.value=="")
		{
			window.alert("请填写操作理由！");
			return;
		}
	}
	if(typeof checkdo == 'undefined')
	{
		if(!window.confirm("您确定要执行操作吗？")) 
			return;
	}
	var form = document.forms[formId];
	form.action = url;

	form.submit();
}

//选择标签
function selectTag(showContent,selfObj){
	// 操作标签
	var tag = document.getElementById("tags").getElementsByTagName("li");
	var taglength = tag.length;
	for(i=0; i<taglength; i++){
		tag[i].className = "";
	}
	selfObj.parentNode.className = "selectTag";
	// 操作内容
	for(i=0; j=document.getElementById("tagContent"+i); i++){
		j.style.display = "none";
	}
	document.getElementById(showContent).style.display = "block";
}

//控制图片显示
var flag=false;
function drawImage(ImgD)
{
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
		flag=true;
	if(image.width/image.height>= 480/640){
		if(image.width>480){
			ImgD.width=480;
			ImgD.height=(image.height*480)/image.width;
		}else{
			ImgD.width=image.width;
			ImgD.height=image.height;
		}
		ImgD.alt=image.width+"x"+image.height;
	}
	else{
		if(image.height>640){
			ImgD.height=640;
			ImgD.width=(image.width*640)/image.height;
		}else{
			ImgD.width=image.width;
			ImgD.height=image.height;
		}
		ImgD.alt=image.width+"x"+image.height;
		}
	}
}
